<template>
	<view class="content">
		<image style="width: 100%;height: 100%;" :src="$ossHost + detail.startPic" mode="scaleToFill"></image>
		<view class="jump-over" @tap="launchFlag()">{{ jumpover }}</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			background: ['color1', 'color2', 'color3'],
			autoplay: false,
			duration: 500,
			jumpover: '跳过',
			experience: '立即体验',
			time: false,
			detail: ''
		};
	},
	created() {
		this.getPic();
	},
	mounted() {
		let i = 5;
		this.time = setInterval(() => {
			i--;
			if (i === 0) {
				clearInterval(this.time);
				this.launchFlag();
			}
		}, 1000);
	},
	methods: {
		getPic() {
			//TODO 目前只有参数1有数据
			this.$http.get('/startPic/2').then(res => {
				this.detail = res.data;
			});
		},
		launchFlag: function() {
			if(this.time){
				clearInterval(this.time);
			}
			const token = uni.getStorageSync('token');
			if (token) {
				//已登录
				uni.reLaunch({
					url: '/pages/index/index'
				});
			} else {
				uni.reLaunch({
					url: '/pages/login/login'
				});
			}
		}
	}
};
</script>
<style>
page,
.content {
	width: 100%;
	height: 100%;
	background-size: 100% auto;
	padding: 0;
}

.swiper {
	width: 100%;
	height: 100%;
	background: #ffffff;
}

.swiper-item {
	width: 100%;
	height: 100%;
	text-align: center;
	position: relative;
	display: flex;
	/* justify-content: center; */
	align-items: flex-end;
	flex-direction: column-reverse;
}

.swiper-item-img {
	width: 100%;
	height: 100%;
}

.swiper-item-img image {
	width: 100%;
	height: 100%;
}

.uniapp-img {
	height: 100%;
	background: #ffffff;
	display: flex;
	justify-content: center;
	align-items: center;
	overflow: hidden;
}

.uniapp-img image {
	width: 100%;
	height: 100%;
}

.jump-over,
.experience {
	position: absolute;
	height: 60upx;
	line-height: 60upx;
	padding: 0 40upx;
	border-radius: 30upx;
	font-size: 32upx;
	color: #fffafa;
	border: 1px solid #fffafa;
	z-index: 999;
}

.jump-over {
	right: 45upx;
	top: 125upx;
}

.experience {
	right: 50%;
	margin-right: -105upx;
	bottom: 0;
}
</style>
